//
//  ZMHorizontalGridViewCell.m
//  Pods
//
//  Created by pg on 2017/9/13.
//
//

#import "ZMHorizontalGridViewCell.h"

#import <Masonry/Masonry.h>


@implementation ZMHorizontalGridViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        float width = 50;
        self.contentView.backgroundColor = [UIColor clearColor];
        self.contentView.clipsToBounds = YES;
        self.iconImageView = [UIImageView new];
        self.iconImageView.contentMode = UIViewContentModeScaleAspectFill;
        self.iconImageView.clipsToBounds = YES;
        self.iconImageView.layer.cornerRadius = width / 2;
        [self.contentView addSubview:self.iconImageView];
        
        self.titleLabel = [UILabel new];
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.titleLabel.font = [UIFont systemFontOfSize:13];
        self.titleLabel.textColor = [UIColor blackColor];
        [self.contentView addSubview:self.titleLabel];
        
        // 布局
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(self.contentView);
            make.height.mas_equalTo(20);
            make.bottom.mas_equalTo(0);
        }];
        
        
        [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.contentView);
            make.bottom.equalTo(self.titleLabel.mas_top).offset(0);
            make.width.height.mas_equalTo(width);
        }];
        
        self.backgroundColor = [UIColor lightGrayColor];
        
    }
    return self;
}




@end
